<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<style>
    .A{
        background-color: pink;
        width: 1000px;
        height: 500px;
        display: block;
    }


    #B{
        background-color: red;
        width: 100px;
        height: 50px;
    }

</style>
<body>
    <script>
    function ab(){
document.getElementsByClassName('A').backgroundcolor='black';
}
</script>
    <div class="A"></div>
    <button type="button" id="B" click="ab(A)"></button>
</body>
</html>